package com.main.ok.echat;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.guahao.im.service.share.base.ResponseDTO;
import com.guahao.im.user.service.share.dto.IMUserDTO;
import com.guahao.im.user.service.share.service.IMUserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * Created by kai on 2015/8/6 0006.
 * 查看用户是否在线,这是echat判定用户在线的依据.
 */
public class EchatUserServiceMain {
    public static void main(String[] args) {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
        IMUserService userService = (IMUserService) applicationContext.getBean("imUserService");
        ResponseDTO<List<IMUserDTO>> user = userService.getUser(123123123571l);
        System.out.println(user.getCode() + "--" + user.getMessage());
        List<IMUserDTO> dataResult = user.getDataResult();
        for (IMUserDTO userDTO : dataResult) {

            System.out.println(userDTO.getHostId() + "-" + userDTO.getUserId() + "--" + userDTO.getSourceId());
        }
    }
}
